|
|
|
|
|
|
|
In each of the Click events for these command buttons, youll see that a module-level variable is used to increment and decrement through the ListImages() collection. Each time through the collection, the Picture property of the current ListImage object is grabbed and its value is placed in the ImageList controls Picture property. |
|
|
|
|
|
|
|
|
Loading the Combo Box with Image Names |
|
|
|
|
|
|
|
|
In the combo box for this form, youll find a list of flag names. To load this list, you use the Tag property of each ListImage object in the ImageList control. Next, you add the Key property to the List() array of the combo box. This is used to select a flag image from the ImageList when you select an entry in the combo box. Heres the code: |
|
|
|
 |
|
|
|
|
Private Sub Form_Load()
Dim intLoop As Integer
Dim oImage As ListImage
For Each oImage In ilsFlags.ListImages
With cboCountries
.AddItem oImage.Tag & _
Space(50) & vbTab & _
oImage.Key
End With
Next
' Initialize Index
mintIndex = 1
' Display first item
Call cmdNext_Click
End Sub |
|
|
|
|
|
|
|
|
In the Form_Load() event, you loop through each image in the ListImages collection. Each time through, you add to the combo box the description of the image from the Tab property. In addition, you add 50 spaces, a tab character, and the Key property of the image. This way, you have the Key property available when you select an item from the combo box, but its spaced so far to the right that it doesnt show up in the drop-down list. |
|
|
|
|
|